﻿import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../../js/UI.js" as Style
import "../../js/util.js" as Util
Rectangle {
    id: rect
    property alias m_headSource: m_head.m_source
    property alias m_name: m_NameText_id.text
    property alias m_online: phonetext.text
    property alias m_visible: imgbottom.visible
    color: "transparent"
    width: m_root_id.width
    height: m_lineValue*1.2
    signal menuclickSignal()
    signal persondetailSignal()
    MouseArea{
        anchors.fill: parent
        onClicked: {
            persondetailSignal()
        }
    }
    HeadImage {
        id: m_head
        width: is_PCScreen ? 0.7*parent.height : parent.height*0.8
        height: width
        anchors.left: parent.left
        anchors.leftMargin:Util.isHDScreen() ? m_lineValue*0.4 : 20 //m_lineValue*0.4
        anchors.verticalCenter: parent.verticalCenter
        nameText: m_NameText_id.text.substring(0,1)
        colorText:m_NameText_id.text.length>1?m_NameText_id.text.substring(1,2):""
    }
    Item {
        width: parent.width-(Util.isHDScreen() ? m_lineValue*2 : 200)//m_root_id.width - m_lineValue*2
        anchors.left: m_head.right
        anchors.leftMargin: Util.isHDScreen() ?  0.2*m_lineValue : 10//m_lineValue*0.3
        height:is_PCScreen ? parent.height*0.8 : parent.height*0.8
        anchors.verticalCenter: parent.verticalCenter
        Item{
            height: parent.height*1
            width: parent.width
            anchors.left: parent.left
            anchors.top: parent.top
            AText {
                anchors.left: parent.left
                //anchors.verticalCenter: parent.verticalCenter
                anchors.top: parent.top
                anchors.topMargin: Util.isHDScreen() ?  0.2*m_lineValue : 10
                //anchors.topMargin: phonetext.text===""?(parent.height-paintedHeight)/2:(parent.height/2-paintedHeight)/2
                id: m_NameText_id
                width: parent.width
                font.pixelSize:Util.isHDScreen() ? Style.hdCommonSize :  Style.pcCommonSize
                font.family: Style.fontfamily
                elide: Text.ElideRight
                wrapMode: Text.NoWrap
            }
        }
        Item{
            height: parent.height*0.5
            width: parent.width
            anchors.left: parent.left
            anchors.bottom: parent.bottom
            AText{
                id: phonetext
                visible: true
                //anchors.verticalCenter: parent.verticalCenter
                anchors.bottom: parent.bottom
                anchors.bottomMargin: Util.isHDScreen() ?  0.1*m_lineValue : 10
                font.pixelSize:Util.isHDScreen() ? Style.hdSmallSize :  Style.pcCommonSize-1
                elide: Text.ElideRight
                wrapMode: Text.NoWrap
                color: "#808080"
                width: parent.width
                text:"在线"
            }
        }
    }
    Image{
        id:imgbottom
        anchors.right: parent.right
        anchors.rightMargin: 0.4*m_lineValue
        anchors.verticalCenter: parent.verticalCenter
        sourceSize: Qt.size(0.6*m_lineValue,0.6*m_lineValue)
        source: "qrc:/images/menu.svg"
        MouseArea{
            anchors.fill: parent
            onClicked: {
                menuclickSignal()
            }
        }
    }
}

